#ifndef __FDCAN_INTERFACE_H__
#define __FDCAN_INTERFACE_H__

#include "main.h"
#include "fdcan.h"

#define CAN_MSG_QUEUE_LENGTH    8

typedef struct
{
    uint32_t id;
    uint8_t length;
    uint8_t data[32];
}can_msg_s;

typedef struct
{
    can_msg_s can_msg[CAN_MSG_QUEUE_LENGTH];
    uint8_t write_index;
    uint8_t read_index;
}can_msg_queue_s;

void fdcan_filter_init(FDCAN_HandleTypeDef * fdcanHandle);
void fdcan_send(uint32_t id, uint8_t *data, uint16_t size);
uint32_t fdcan_recv(void);
void push_queue(uint32_t id, uint8_t *data, uint16_t size);
void pull_queue(void);
void fdcan_enable(void);

#endif
